package br.uneb.tebd;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import br.uneb.tebd.local.CreateLocalGuitar;
import br.uneb.tebd.local.CreateLocalGuitarCP;
import br.uneb.tebd.local.DeleteLocalGuitarByDescription;
import br.uneb.tebd.local.ListLocalGuitar;
import br.uneb.tebd.local.SelectLocalGuitarByDescription;
import br.uneb.tebd.local.UpdateLocalGuitar;
import br.uneb.tebd.webservice.CreateGuitarWS;
import br.uneb.tebd.webservice.DeleteByDescriptionWS;
import br.uneb.tebd.webservice.FindByDescriptionWS;
import br.uneb.tebd.webservice.UpdateGuitarWS;

public class MainActivity extends ListActivity {
    /** Called when the activity is first created. */
	
	public static final String[] nomes = new String[] {
		"Cadastrar Localmente",
		"Cadastrar Externamente",
		"Cadastrar Localmente com CP",
		"Listar todas Localmente",
		"Buscar Localmente",
		"Buscar Externamente",
		"Update Localmente",
		"Update Externamente",
		"Deletar Localmente",
		"Deletar Externamente"
	};
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, nomes));
    }

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		switch (position) {
			case 0:
				this.startActivity(new Intent(this, CreateLocalGuitar.class));
				break;
			case 1:
				this.startActivity(new Intent(this, CreateGuitarWS.class));
				break;
			case 2:
				this.startActivity(new Intent(this, CreateLocalGuitarCP.class));
				break;
			case 3:
				this.startActivity(new Intent(this, ListLocalGuitar.class));
				break;
			case 4:
				this.startActivity(new Intent(this, SelectLocalGuitarByDescription.class));
				break;
			case 5:
				this.startActivity(new Intent(this, FindByDescriptionWS.class));
				break;
			case 6:
				this.startActivity(new Intent(this, UpdateLocalGuitar.class));
				break;
			case 7:
				this.startActivity(new Intent(this, UpdateGuitarWS.class));
				break;
			case 8:
				this.startActivity(new Intent(this, DeleteLocalGuitarByDescription.class));
				break;
			case 9:
				this.startActivity(new Intent(this, DeleteByDescriptionWS.class));
				break;
		}
		
	}
    
    
    

    
    
}